﻿using Core.Tools;
using Core.Tools.IOC;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Unity;
using Shell.Views;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using UI.Application.Share.Event;

namespace Shell
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : PrismApplication
    {
        protected override Window CreateShell()
        {
            MainWindow window = new MainWindow();
            return window;
        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            
        }

        protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
        {
            base.ConfigureModuleCatalog(moduleCatalog);

            //加载自己写的模块，比如加载Core.Tools模块

            moduleCatalog.AddModule<CoreToolsModule>();//加载工具模块
        }

        protected override IModuleCatalog CreateModuleCatalog()
        {
            return new DirectoryModuleCatalog() {  ModulePath = @".\Modules"};//配置模块目录


        }

        protected override void OnExit(ExitEventArgs e)
        {
            base.OnExit(e);

            PrismProvider.EventAggregator.GetEvent<ApplicationExitEvent>().Publish();//程序退出时触发事件
        }
    }
}
